package com.woniu.util;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;

@ToString
@NoArgsConstructor
@AllArgsConstructor
@Data
public class ResponseUtil {
    private Integer code;
    private String msg;
    private Object data;

    public ResponseUtil(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public static ResponseUtil get(ResponseEnum responseEnum,Object data){
        return new ResponseUtil(responseEnum.getCode(), responseEnum.getMsg(),data);
    }

    public static ResponseUtil get(ResponseEnum responseEnum){
        return new ResponseUtil(responseEnum.getCode(), responseEnum.getMsg());
    }
}
